﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using Wuqi.Webdiyer;
namespace StoreWeb.system.userManage
{
    public partial class list : System.Web.UI.Page
    {
        Maticsoft.BLL.UserAdmin userdealers = new Maticsoft.BLL.UserAdmin();
        //BLL.Role role = new BLL.Role();
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                int totalOrders = userdealers.GetRecordCount("");
                AspNetPager1.RecordCount = totalOrders;
            }
        }
        void bindData()
        {

            Repeater1.DataSource = userdealers.GetListByPage("", " ", AspNetPager1.StartRecordIndex, AspNetPager1.EndRecordIndex);
            Repeater1.DataBind();
        }

        protected void AspNetPager1_PageChanged(object src, EventArgs e)
        {
            bindData();
        }

        /// <summary>
        /// 获得用户名
        /// </summary>
        /// <param name="parentid"></param>
        /// <returns></returns>
        protected string GetUserName(String dealersid)
        {
            if (dealersid == "" || dealersid == "0")
            {
                return "";
            }
            else
            {
                return new BLL.DealersManage().GetModel(Convert.ToInt32(dealersid)).username + "【" + new BLL.DealersManage().GetModel(Convert.ToInt32(dealersid)).dealersgrade + "级】";
                //return "";
            }
        }

        /// <summary>
        /// 获得角色
        /// </summary>
        /// <param name="parentid"></param>
        /// <returns></returns>
        protected string GetRoleName(String userid)
        {
            if (userid == "" || userid == "0")
            {
                return "";
            }
            else
            {
                String roleid = new Maticsoft.BLL.UserRoleRelation().GetList(" userid=" + userid + " ").Tables[0].Rows[0][2].ToString();
                return new Maticsoft.BLL.Role().GetModel(Convert.ToInt32(roleid)).rolename;
                //return "";
            }
        }
    }
}